{
  "cells": [
    {
      "cell_type": "markdown",
      "id": "3c6cf2b9-adaa-4b76-b634-0ba958d5e1c0",
      "metadata": {},
      "source": [
        "# 👋🌍 Hello, world: Submit a Qiskit job to Rigetti\n",
        "\n",
        "In this notebook, we'll review the basics of Azure Quantum by submitting a simple *job*, or quantum program, to [Rigetti](https://www.rigetti.com/). We will use [Qiskit](https://qiskit.org/) to express the quantum job."
      ]
    },
    {
      "cell_type": "markdown",
      "id": "e54861bf-022b-4eb0-b6e5-288dda83fb80",
      "metadata": {
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      },
      "source": [
        "## Submit a simple job to Rigetti using Azure Quantum\n",
        "Azure Quantum provides several ways to express quantum programs. In this example we are using Qiskit, but note that Q# is also supported. All code in this example will be written in Python.\n",
        "\n",
        "Let's begin. When you see a code block, hover over it and click the triangle play-button to execute it. To avoid any compilation issues, this should be done in order from top to bottom."
      ]
    },
    {
      "cell_type": "markdown",
      "id": "76b1e035-6876-4c17-9301-889e61f16e97",
      "metadata": {
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      },
      "source": [
        "### 1. Connect to the Azure Quantum workspace\n",
        "\n",
        "To connect to the Azure Quantum service, construct an instance of the `AzureQuantumProvider` class. Note that it's imported from the `azure.quantum.qiskit` package."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "id": "4287780f-cdfb-41d4-843d-a5b38d24f122",
      "metadata": {},
      "outputs": [],
      "source": [
        "from azure.quantum.qiskit import AzureQuantumProvider\n",
        "provider = AzureQuantumProvider (\n",
        "    resource_id = \"\",\n",
        "    location = \"\"\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "184eb608-ca3b-4935-b8c5-92d2288341d7",
      "metadata": {
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      },
      "source": [
        "Let's import some packages and see what providers and targets are enabled in this workspace with the following command:\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "id": "e199b42d-14f8-4daf-b3e8-1847abe2391a",
      "metadata": {
        "jupyter": {
          "outputs_hidden": false,
          "source_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      },
      "outputs": [],
      "source": [
        "from qiskit import QuantumCircuit\n",
        "from qiskit.visualization import plot_histogram\n",
        "from qiskit.tools.monitor import job_monitor\n",
        "\n",
        "print(\"This workspace's targets:\")\n",
        "for backend in provider.backends():\n",
        "    print(\"- \" + backend.name())"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "f627710d-a70f-4a3a-b4a6-533d5db9482e",
      "metadata": {
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      },
      "source": [
        "### ❕ Do you see `rigetti.sim.qvm` in your list of targets? If so, you're ready to keep going.\n",
        "\n",
        "Don't see it? You may need to add Rigetti to your workspace to run this sample. Navigate to the **Providers** page in the portal and click **+Add** to add the Rigetti provider."
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "id": "6b9b73c6-a33d-4270-9587-f3885294fc6b",
      "metadata": {
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      },
      "source": [
        "## Rigetti: The quantum provider\n",
        "Azure Quantum partners with third-party companies to deliver solutions to quantum jobs. These company offerings are called *providers*. Each provider can offer multiple *targets* with different capabilities. See the table below for Rigetti's targets.\n",
        "\n",
        "| Target name | Target ID | Number of qubits | Description |\n",
        "| --- | --- | --- | --- |\n",
        "| Rigetti QVM (simulator) | `rigetti.sim.qvm` | 20 qubits | Rigetti's cloud-based, [open-source](https://github.com/quil-lang/qvm) \"Quantum Virtual Machine\" simulator. Free to use. |\n",
        "| Aspen M-3 (hardware) | `rigetti.qpu.aspen-m-3` | 80 qubits | Rigetti's \"Aspen-M-3\" universal, physical QPU. Read more at [Rigetti's website](https://qcs.rigetti.com/qpus). |\n",
        "\n",
        "\n",
        "For this example, we will use `rigetti.sim.qvm`. To learn more about Rigetti's targets, check out [Rigetti's Azure Quantum documentation](https://docs.microsoft.com/azure/quantum/provider-rigetti)."
      ]
    },
    {
      "cell_type": "markdown",
      "id": "1b094a8a-76f0-4a49-a0b6-3736f73c18a8",
      "metadata": {},
      "source": [
        "### 2. Build the quantum program\n",
        "\n",
        "Let's create a simple Qiskit circuit to run."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 45,
      "id": "7b42a2c4-cf76-4678-bdce-54ba6d6679e6",
      "metadata": {},
      "outputs": [
        {
          "data": {
            "text/html": [
              "<pre style=\"word-wrap: normal;white-space: pre;background: #fff0;line-height: 1.1;font-family: &quot;Courier New&quot;,Courier,monospace\">     ┌───┐┌─┐\n",
              "  q: ┤ H ├┤M├\n",
              "     └───┘└╥┘\n",
              "c: 1/══════╩═\n",
              "           0 </pre>"
            ],
            "text/plain": [
              "     ┌───┐┌─┐\n",
              "  q: ┤ H ├┤M├\n",
              "     └───┘└╥┘\n",
              "c: 1/══════╩═\n",
              "           0 "
            ]
          },
          "execution_count": 45,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# Create a quantum circuit acting on a single qubit\n",
        "circuit = QuantumCircuit(1, 1)\n",
        "circuit.name = \"Single qubit random\"\n",
        "circuit.h(0)\n",
        "circuit.measure(0, 0)\n",
        "\n",
        "# Print out the circuit\n",
        "circuit.draw()"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "23f20a40-c972-470d-9c0e-5cd6c1c2eb38",
      "metadata": {
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      },
      "source": [
        "The circuit you built is a simple quantum random bit generator. With Rigetti's simulator, we will be able to estimate the probability of measuring a `1` or `0`."
      ]
    },
    {
      "cell_type": "markdown",
      "id": "034aec28-a624-4d9a-9899-67b69543d82d",
      "metadata": {},
      "source": [
        "### 3. Submit the quantum program to Rigetti"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 46,
      "id": "486ab624-bfde-4ae5-971d-02727620938f",
      "metadata": {
        "jupyter": {
          "outputs_hidden": false,
          "source_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Job id: 444cc976-ec31-11ec-95ba-00155d507810\n"
          ]
        }
      ],
      "source": [
        "from azure.quantum.target.rigetti import RigettiTarget\n",
        "\n",
        "# Create an object that represents Rigetti's simulator target, \"rigetti.sim.qvm,\" using the packaged constant.\n",
        "#   Note that any quantum computing target you have enabled in this workspace can be used here.\n",
        "#   Azure Quantum makes it extremely easy to submit the same quantum program to different providers.\n",
        "rigetti_simulator_backend = provider.get_backend(RigettiTarget.QVM)\n",
        "\n",
        "# Using the Rigetti simulator target, call \"run\" to submit the job. We'll\n",
        "# use 100 shots (simulated runs).\n",
        "job = rigetti_simulator_backend.run((circuit), count=100)\n",
        "print(\"Job id:\", job.id())"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "6e72d784-5a53-4d7e-bdbe-44919c13848c",
      "metadata": {
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      },
      "source": [
        "The job ID can be used to retrieve the results later using the [`get_job` method](https://learn.microsoft.com/azure/quantum/optimization-workspace#workspaceget_job) or by viewing it under the **Job management** section of the portal."
      ]
    },
    {
      "cell_type": "markdown",
      "id": "4b4aff68-125a-4c81-9bdd-d326ec61e9ea",
      "metadata": {
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      },
      "source": [
        "### 4. Obtain the job results\n",
        "You can monitor the job status with Qiskit's `job_monitor` function.\n",
        "\n",
        "This may take a minute or so ⏳. Your job will be packaged and sent to Rigetti, where it will wait its turn to be run. You'll see your job go through these stages: \"job is queued\" -> \"job is actively running\" -> \"job has successfully run.\""
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 47,
      "id": "cac1e6a4-60b9-4840-b327-86475796e3c1",
      "metadata": {},
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Job Status: job has successfully run\n"
          ]
        },
        {
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAcQAAAFNCAYAAACe4B8PAAAAOXRFWHRTb2Z0d2FyZQBNYXRwb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HFxcQARYXggHBMSEujfvz8Azz77rHt06slAbKZycnJYvnw527dvp23btvTo0YNevXrRr1+/8JGmtbW1xMXFsXfvXq677jrOPffcpi5barZiYmLCYVhbW0tMTEz4C+z3txSrq6vJysrivPPOi3qdJzJ3mTYjB75Frlu3jhdeeIHzzz+fESNG8NVXX/HnP/+ZrVu3EhsbyxVXXMFVV10VsWxNTY233JKi7ECf3bRpE6+//jpXXXUV55xzTsQ8B44FAKioqKBNmzZNUepJwUBsRg7sHn3kkUfo0qULN910U8Tj5eXlLF68mIULF3L55Zczfvz4JqpUEvxfn501axbr1q2jVatWBINBzjvvPEaNGkWvXr3C8+bm5rJ8+XL+9V//tekKPsH5lb8ZOTBWGAgEqKioCO92ObD1l5CQwNixY4mPj2fVqlV899134VtzSYq+2NhYampqKCkpYfz48fTt25fNmzfz4YcfMnXqVJKTkxk+fDijRo1i1apVFBQUAJ5/+EMZiM1MbGwsw4YNY86cOVx44YWcccYZxMfHA/+3W3TEiBG8/fbblJWV0aFDB69WIzWhwsJCOnXqRLt27ejRowennXYaF110ETt37uQvf/kLH330EW+99RahUIipU6c2dbknNHeZNiPBYJCYmBj27t3L7373O95//30GDhzIxRdfzHnnnUcgEKC8vJw1a9bw8ssvM2fOnKYuWWrWDnxJPXDz9LS0tIMeLy0t5Y033uCDDz7g+eefb4oyTxoGYjOxc+dOVq9ezdixY8Ntf/rTn3j//ffZsWMHlZWVdOzYkdraWiorKxk5ciRXXnll+EhTSdG1c+dO3n//fcaOHXvUPTTTp08nLS2NSZMm2WePgbtMm4kFCxbw9ddfRwTisGHD6NmzJzt27OC7775j165dhEIhRo4cSefOnQEch5CayIE+O27cuIj2748P7tmzh7Zt23LNNdcAB5+CobpzC7GZmDx5MoFAgLPPPpvu3bvTo0ePiOuTOggvHV++32dPP/10kpOTI+Y50G8rKipo3bp10xR6EjEQm4mvv/6a999/n/Xr1wPQoUOHcCfLyMg46NwlA1JqWofqsxkZGfTq1Yvu3bsfFICeK3zsDMRmpqamhq1bt/LOO++wbds2WrZsSXp6Oj179qRXr15069aNQCDAokWLGD58OImJiU1dstSs2Wejx0BsxioqKsjNzeWdd96hoKCAhIQEevToAcCiRYt48cUXveqFdByxzzYuA1EAFBUVsXbtWj744APy8vK45JJLyMrKauqyJB2GfbbhGYiKEAwG+eabb4iPjz/onCdJxx/7bMMxECVJAjyMUJIkDERJkgADUZIkwECUJAkwECVJAuD/A9ajVoYl3nSVAAAAAElFTkSuQmCC",
            "text/plain": [
              "<Figure size 504x360 with 1 Axes>"
            ]
          },
          "execution_count": 47,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "import matplotlib.pyplot as plt\n",
        "\n",
        "# Style the plot for readability.\n",
        "plt.style.use('ggplot')\n",
        "\n",
        "# Monitor the job.\n",
        "job_monitor(job)\n",
        "result = job.result()\n",
        "\n",
        "# The result object is native to the Qiskit package, so we can use Qiskit's tools to print the result as a histogram.\n",
        "plot_histogram(result.get_counts(circuit), title=\"Result\")"
      ]
    },
    {
      "cell_type": "markdown",
      "id": "5ff0a2d1-1b1d-42eb-b7a9-eea305cc5cab",
      "metadata": {
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      },
      "source": [
        "**See the histogram above? Congratulations, you've submitted a job with Azure Quantum! 👏**\n"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "id": "2f495b50-6481-4c66-8ff4-0a46d8a74aba",
      "metadata": {
        "nteract": {
          "transient": {
            "deleting": false
          }
        }
      },
      "source": [
        "### 5. Next steps\n",
        "Next, you can try running a program on one of Rigetti's hardware targets. Just replace `RigettiTarget.QVM` with `RigettiTarget.ASPEN_M_3`. Or try another sample by navigating back to the sample gallery. The same \"hello world\" sample can be run with different quantum providers by choosing another option in the gallery card drop-down menu. Don't worry - your work here is automatically saved.\n",
        "\n",
        "To learn more about submitting Qiskit circuits to Azure Quantum, review the Qiskit section of the [Azure Quantum documentation's page on Qiskit jobs](https://docs.microsoft.com/azure/quantum/quickstart-microsoft-qiskit?pivots=platform-rigetti).\n",
        "\n",
        "To learn more about job pricing, review the [Azure Quantum documentation's pricing page](https://docs.microsoft.com/azure/quantum/azure-quantum-job-costs)."
      ]
    }
  ],
  "metadata": {
    "kernel_info": {
      "name": "python3"
    },
    "kernelspec": {
      "display_name": "Python 3 (ipykernel)",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.13"
    },
    "nteract": {
      "version": "nteract-front-end@1.0.0"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
